<template>
	<view class="u-p-t-10">
		<u-empty v-if="!list.length" text="无数据" mode="page"></u-empty>
		<u-cell-group>
			<view v-for="(item, index) in list" :key="index">
				<u-cell-item :title="getTyp(item.remark)" :label="item.beginDate.substring(0, 10)" @click="goTo(item.id)"><u-tag :text="item.name" /></u-cell-item>
				<u-line></u-line>
			</view>
		</u-cell-group>
	</view>
</template>

<script>
export default {
	data() {
		return {
			model: {},
			list: [],
			type: []
		};
	},
	onShow() {
		this.request({
			url: 'EamPlanMaint/todo',
			success: res => {
				this.list = res.data;
			}
		});
	},
	onLoad() {
		this.request({
			url: 'BaseEquipment/pages',
			data: {
				limit: 0
			},
			success: res => {
				this.type = res.data;
			}
		});
	},
	methods: {
		goTo(id) {
			uni.navigateTo({
				url: 'exec?id=' + id
			});
		},
		getTyp(id) {
			let typ = this.type.find(m => m.code == id);
			if (typ != undefined) return typ.name;
		}
	}
};
</script>

<style lang="scss">
page {
	background-color: #ededed;
}
.user-box {
	background-color: #fff;
}
</style>
